package com.timschimandle.getitdone;

import java.io.Serializable;

public class Task implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	//the id must be added using getters and setters
	private Long id;
	private String title;
	private int[] frequency = new int[3]; 
	private Long person;
	private int active; //a zero or one will be here for 
	
	public Task(Long id, String title, int day, int month, int year, Long person, int a){
		this.id = id;
		this.title = title;
		this.frequency[0] = day;
		this.frequency[1] = month;
		this.frequency[2] = year;
		this.person = person;
		
		if (a == 1) {
			this.active = a;
		} else {
			this.active = 0;
		}
		
	}
	
	public Task(Long id, String title, int day, int month, int year, Long person, boolean a) {
		this.id = id;
		this.title = title;
		this.frequency[0] = day;
		this.frequency[1] = month;
		this.frequency[2] = year;
		this.person = person;
		
		if (a) {
			this.active = 1;
		} else {
			this.active = 0;
		}
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	public int[] getFrequency() {
		return frequency;
	}
	public void setFrequency(int[] frequency) {
		if (frequency.length == 3) {
			this.frequency = frequency;
		}
	}
	public int getDatePart(int position) {
		if (position <3 && position >-1) {
			return frequency[position];
		} else {
			return 0;
		}
	}
	
	public Long getPerson() {
		return person;
	}
	public void setPerson(Long person) {
		this.person = person;
	}
	public int getActive() {
		return active;
	}
	public void setActive(int active) {
		this.active = active;
	}
	
	
	
	
}
